//
//  Network.h
//  netWorkDefine
//
//  Created by VierGhost on 15/9/1.
//  Copyright (c) 2015年 dingli. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import <UIKit/UIKit.h>

#define timeoutTime 15.0f
#define aniDelayTime 0.5f
#define REQUEST_CALLBACK void (^)(Network *response)

@interface Network : NSObject

+ (void)link_body:(NSString *)url parameters:(NSDictionary *)params outOfTime:(float)outTime callback:(void (^)(id responseObject))callback;

+ (Network *)sharedJsonRequest;

+ (BOOL)link:(NSString*)url parameters:(NSDictionary *)params outOfTime:(float)outTime callback:(REQUEST_CALLBACK)callback;
+ (BOOL)linkWithoutLoadingAnimation:(NSString*)url parameters:(NSDictionary *)params outOfTime:(float)outTime callback:(REQUEST_CALLBACK)callback;

// 图片上传
//+ (BOOL)postImageData:(NSArray *)imageData
//                  url:(NSString *)url
//               params:(NSDictionary *)params
//            outOfTime:(float)outTime
//                alert:(BOOL)alert
//             callback:(REQUEST_CALLBACK)callback;

+ (BOOL)link:(NSString*)url parameters:(NSDictionary *)params imgParameters:(NSArray *)imgParameters fileNames:(NSArray *)fileNames materialtype:(NSInteger)materialtype outOfTime:(float)outTime callback:(REQUEST_CALLBACK)callback;

/** cancel Task mission */
- (void)cancelAllTask;
- (void)cancelTaskWithTaskIdentifier:(NSNumber *)taskIdentifier;

#pragma mark - @property
@property(strong, nonatomic) NSDictionary *header;//请求头
@property(assign, nonatomic) NSInteger status;//状态值
@property(strong, nonatomic) NSString *message;//请求失败时，返回信息
@property(assign, nonatomic) NSInteger responCode;//服务器返回状态值
@property(strong, nonatomic) NSError *error;//请求失败时，错误信息
@property (nonatomic, strong) NSDictionary *dataDic;//主数据

@property (nonatomic, strong)NSData *certData;

@end
